﻿using System.Data;
using System.Data.SqlClient;
namespace kaoshi
{
    internal class DbHelper
    {
        private static readonly string Kaiye = "server = .;database=CMS;uid=sa;pwd=123456;";
        public static DataTable GetData(string sql)
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql, Kaiye);
            DataTable data = new DataTable();
            adapter.Fill(data);
            return data;
        }
        public static int SenYe(string sql)
        {
            SqlConnection connection = new SqlConnection(Kaiye);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            int YueGe = command.ExecuteNonQuery();
            connection.Close();
            return YueGe;
        }


    }
}